<template>
	<view>
		<u-toast ref="uToast" /><u-no-network></u-no-network>
		<u-navbar title="我的账户" safeAreaInsetTop fixed placeholder>
			<view class="coreshop-navbar-left-slot" slot="left">
				<u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
				<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
				<u-icon name="home" size="22" @click="goHome"></u-icon>
			</view>
			<view slot="right">
			</view>
		</u-navbar>
		<view class="content">
			<view class='withdrawcash-top'>
				<text class='withdrawcash-title'>账户余额（元）</text>
				<text class='withdrawcash-num'>{{ userInfo.balance }}</text>
			</view>
			<view class="coreshop-list menu card-menu coreshop-margin-top-15">
				<view class="coreshop-list-item arrow" v-if="showRecharge"
					@click="navigateToHandle('/pages/member/balance/recharge/recharge')">
					<view class="content">
						<u-icon name="gift" size="16" class="coreshop-text-grey" label="账户充值"></u-icon>
					</view>
				</view>
				<!-- <view class="coreshop-list-item arrow"
					@click="navigateToHandle('/pages/member/balance/withdrawCash/withdrawCash')">
					<view class="content">
						<u-icon name="rmb" size="16" class="coreshop-text-yellow" label="余额提现"></u-icon>
					</view>
				</view> -->
				<view class="coreshop-list-item arrow" @click="navigateToHandle('/pages/member/balance/details/details')">
					<view class="content">
						<u-icon name="rmb-circle" size="16" class="coreshop-text-olive" label="余额明细"></u-icon>
					</view>
				</view>
				<!-- <view class="coreshop-list-item arrow" @click="navigateToHandle('/pages/member/balance/cashlist/cashlist')">
					<view class="content">
						<u-icon name="list-dot" size="16" class="coreshop-text-orange" label="提现记录"></u-icon>
					</view>
				</view> -->
				<!-- <view class="coreshop-list-item arrow" @click="navigateToHandle('/pages/member/balance/bankcard/bankcard')">
					<view class="content">
						<u-icon name="coupon" size="16" class="coreshop-text-blue" label="我的银行卡"></u-icon>
					</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {},
				platform: 'ios',
			}
		},
		computed: {
			showRecharge() {
				return this.$store.state.config.showStoreBalanceRechargeSwitch === 1;
			}
		},
		onShow() {
			this.getUserInfo();
		},
		methods: {
			// 获取用户信息
			getUserInfo() {
				let _this = this;
				uni.getSystemInfo({
					success: function(res) {
						_this.platform = res.platform;
					}
				});

				this.$u.api.userInfo().then(res => {
					if (res.status) {
						this.userInfo = res.data
					} else {
						this.$u.toast(res.msg)
					}
				})
			},
			// 页面跳转
			navigateToHandle(pageUrl) {
				this.$u.route(pageUrl)
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "index.scss";
</style>